package cn.edu.gcu.lost.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.edu.gcu.lost.entity.Phone;
import cn.edu.gcu.lost.service.PhoneService;

@RequestMapping("phone")
@Controller
public class PhoneController {


    @Autowired
    PhoneService phoneService;

    @ResponseBody
    @RequestMapping("find")
    public Map<String, Object> findList() {
        Map<String, Object> resultMap = new HashMap<String, Object>(16);
        List<Phone> list = phoneService.findList();
        resultMap.put("data", list);
        if (list.isEmpty()) {
            resultMap.put("data", null);
        }
        resultMap.put("result", "sucess");
        return resultMap;
    }


}
